<!DOCTYPE html>
<html>
<head>
  <title></title>
</head>
<body>
<span id="harry" style="line-height: 32px;">&nbsp;</span><br>
<input id="trigger" type="text">
<script type="text/javascript">
  let harry = document.getElementById('harry')
  let trigger = document.getElementById('trigger')
  let key = 'profile' // 对象属性键名
  let store = {}      // 辅助get取值
  let obj = {         // 对象
    profile: ''
  }
  Object.defineProperty(obj, key, {
    set (value) {
      harry.innerText = value // 重点: 修改DOM节点视图
      store[key] = value
    },
    get () {
      return store[key]
    }
  })
  trigger.addEventListener('keyup', function () {
    obj[key] = this.value
    console.log(obj[key])
  })
</script>
</body>
</html>